package com.hs.wa.service;


import com.springnew.dao.RuleemployeeMapper;
import com.springnew.model.Ruleemployee;
import com.springnew.model.RuleemployeeExample;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class RuleEmployeeService {
    @Autowired
    private RuleemployeeMapper ruleemployeeMapper;

    public List<Ruleemployee> selectRuleEmployee() {
        RuleemployeeExample ruleEmployeeCondition = new RuleemployeeExample();
        ruleEmployeeCondition.createCriteria().andIndexnameIsNotNull();
        return ruleemployeeMapper.selectByExample(ruleEmployeeCondition);
    }

    public boolean updateRuleEmployee(Ruleemployee ruleEmployee) {
        boolean flag = false;
        RuleemployeeExample ruleEmployeeCondition = new RuleemployeeExample();
        ruleEmployeeCondition.createCriteria().andNoEqualTo(ruleEmployee.getNo()).andStatusEqualTo("0");
        int i = ruleemployeeMapper.updateByExample(ruleEmployee, ruleEmployeeCondition);
        if (i > 0) {
            flag = true;
        }
        return flag;
    }
}
